namespace IAM.Interface.Model
{
    using IAM.Interface.Model.ENUM;
    using IAM.Interface.Model.Interface;
    using System;
    using System.Text;

    public class IdenManageOperationType : AbstractConvertObject, IConvertXml
    {
        private IAM.Interface.Model.ENUM.OperationType _operationtype = IAM.Interface.Model.ENUM.OperationType.Create;

        public override object ConvertToObject()
        {
            string text = this.CurrentXmlNode.InnerText.ToLower();
            if (text != null)
            {
                if (!(text == "create"))
                {
                    if (text == "enable")
                    {
                        this.OperationType = IAM.Interface.Model.ENUM.OperationType.Enable;
                    }
                    else if (text == "disable")
                    {
                        this.OperationType = IAM.Interface.Model.ENUM.OperationType.Disable;
                    }
                    else if (text == "delete")
                    {
                        this.OperationType = IAM.Interface.Model.ENUM.OperationType.Delete;
                    }
                    else if (text == "update")
                    {
                        this.OperationType = IAM.Interface.Model.ENUM.OperationType.Update;
                    }
                }
                else
                {
                    this.OperationType = IAM.Interface.Model.ENUM.OperationType.Create;
                }
            }
            return this;
        }

        public IAM.Interface.Model.ENUM.OperationType OperationType
        {
            get
            {
                return this._operationtype;
            }
            set
            {
                this._operationtype = value;
            }
        }

        public string XML
        {
            get
            {
                return (this.XMLBoday + this.XMLFinis);
            }
        }

        public string XMLBoday
        {
            get
            {
                StringBuilder xml = new StringBuilder();
                xml.Append(" <OperationType> ");
                xml.Append(this.OperationType.ToString());
                return xml.ToString();
            }
        }

        public string XMLFinis
        {
            get
            {
                return "</OperationType>";
            }
        }
    }
}
